package loveqq.niceexcel.read.builder;

import java.util.List;

/**
 * @author zhongjh@tsintergy.com
 * @date 2022-08-22
 */
public class ExcelSheetReaderBuilder<T> extends ReadConfigReaderBuilder<ExcelSheetReaderBuilder<T>> {
    private final ReadSheetBuilder<T> sheetBuilder;

    public ExcelSheetReaderBuilder(Class<T> headClass) {
        this.sheetBuilder = new ReadSheetBuilder<>(headClass);
    }

    public List<T> doRead() {
        return build().read(this.sheetBuilder.build());
    }

    public ExcelSheetReaderBuilder<T> sheet() {
        return sheet(0);
    }

    public ExcelSheetReaderBuilder<T> sheet(Integer... sheetIndex) {
        this.sheetBuilder.sheetIndex(sheetIndex);
        return this;
    }

    public ExcelSheetReaderBuilder<T> sheet(String... sheetName) {
        this.sheetBuilder.sheetName(sheetName);
        return this;
    }

    public ExcelSheetReaderBuilder<T> sheetAll() {
        this.sheetBuilder.sheetAll();
        return this;
    }

}
